<template>
  <div class="detail-wrap">
    <div class="detail-header">
      <span>{{ detailData.title }}</span>
      <el-button @click="handleBack">返回</el-button>
    </div>
    <div class="detail-body">
      <pre>{{ detailData.content }}</pre>
    </div>
    <div class="detail-footer">
      <div class="name">分享人：{{ detailData.name }}</div>
      <div class="time">分享时间：{{ detailData.time }}</div>
    </div>
  </div>
</template>

<script>
import { list } from '@/config/data'
export default {
  data() {
    return {
      list,
      detailData: {}
    }
  },
  created() {
    this.detailData = this.list.find(item => item.id == this.$route.query.id) || {}
  },
  methods: {
    handleBack() {
      this.$router.back()
    }
  }
}
</script>

<style lang="less" scoped>
.detail-body {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  margin-right: 20px;
  font-size: 18px;
  font-weight: bold;
  border-bottom: 1px solid #ebeef5;
}
.detail-footer {
  padding-right: 20px;
  text-align: right;
  font-size: 12px;
}
.time {
  font-size: 12px;
  color: #999;
}
</style>
